<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>Document</title>
  </head>
  <body>
    <script>
      var reg = /^abc$/;
      console.log(reg.test('abc'));      // 结果为：true
      console.log(reg.test('abcd'));     // 结果为：false
      console.log(reg.test('aabcd'));    // 结果为：false
      console.log(reg.test('abcabc'));   // 结果为：false
    </script>
  </body>
</html>